﻿{extend name="public:base" /}

{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>提现金额</th>
                                <th>姓名</th>
                                <th>银行卡号</th>
                                <th>银行名称</th>
                                <th>状态</th>
                                <th>驳回原因</th>
                                <th>打款时间</th>
                                <th>申请时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo.id}</td>
                                <td>{$vo.money}</td>
                                <td>{$vo.user_name}</td>
                                <td>{$vo.card_num}</td>
                                <td>{$vo.bank_name}</td>
                                <td>{$vo.status|doWithdrawalStatus}</td>
                                <td>{$vo.note}</td>
                                <td>{$vo.paytime|timeFormat}</td>
                                <td>{$vo.createtime|timeFormat}</td>
                                <td class="project-actions">
                                    {if $vo.status == 0}
                                    <a href="{:url('agreeWithdrawal', ['id' => $vo.id])}" class="btn btn-white btn-sm ajax-operate"><i class="iconfont icon-success"></i> 通过
                                    </a>
                                    <a href="javascript: void(0)" class="btn btn-white btn-sm" onclick="logId({$vo.id})" data-toggle="modal" data-target="#refuseWithdrawal"><i class="iconfont icon-refuse"></i> 驳回
                                    </a>
                                    {/if}
                                    {if $vo.status == 1}
                                    <a href="{:url('payWithdrawal', ['id' => $vo.id])}" class="btn btn-white btn-sm ajax-operate"><i class="iconfont icon-change"></i> 打款
                                    </a>
                                    {/if}
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {if !empty($list)}{$list->render()}{/if}
                    </div>
                </div>
            </div>
        </div>

        <!--    修改密码弹框    -->
        <div class="modal inmodal" id="refuseWithdrawal" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content animated flipInY">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
                        </button>
                        <h4 class="modal-title">驳回</h4>
                    </div>
                    <div class="modal-body">
                        <input type="text" class="form-control note" placeholder="驳回原因">
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-white close-model" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" id="refuse">驳回</button>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

{/block}

{block name="js"}
<script>
    var id = 0;

    function logId(log_id) {
        id = log_id
    }

    $('#refuse').click(function () {
        var note = $('.note').val();
        $.post('/admin/manage/refuseWithdrawal', {id, note}, res => {
            if (res.result == 1) {
                layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                    location.reload()
                })
            } else {
                layer.msg(res.msg, {icon: 2, time: 1000})
            }
        }, 'json')
    })
</script>{/block}

